package com.epam.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.epam.dao.h2.H2TrainingDao;
import com.epam.entity.Teacher;
import com.epam.service.TrainingListForTeacher;

public class AddEvolutionsAction implements Action {
	private static H2TrainingDao h2TrainingDao = new H2TrainingDao();
	
	@Override
	public String perform(HttpServletRequest request,
			HttpServletResponse response) {
		String trainingid = request.getParameter("trainingid");
		String review = request.getParameter("review");
		String mark = request.getParameter("mark");
		h2TrainingDao.update(Long.parseLong(trainingid),Integer.parseInt(mark), review);
		Teacher teacher = (Teacher) request.getSession().getAttribute("teacher");
		TrainingListForTeacher trList = new TrainingListForTeacher(
				teacher.getId());
		request.setAttribute("trlist", trList);
		return "/teacherscabinet.jsp";
	}

}
